#!/bin/csh 
#----------------------------------------------------
#
# script to make geographic plot
#
# kai zhang, max planck institute for meteorology
#
#----------------------------------------------------

setenv EXPA  "E0001B" 
setenv EXPB  "HAM2RE031" 
setenv EXPB  "HAM2RE020" 
setenv EXPB  "HAM2R46" 
foreach EXPB  ("HAM2R46H") 
#foreach EXPB  ("HAM2R46H" "HAM2RE031" "HAM2RE020" "HAM2RE013") 
setenv DDIR  "./data/" 
setenv PDIR  "./plot/" 
setenv PDATA "FT" 
setenv PP_MS "FT" 
setenv PP_BD "FT" 
setenv PP_NM "FT" 
setenv PP_RD "T" 
setenv NCL ncl
#setenv NCL        "/scratch/work/system/sw/sles10-x64/ncl-5.1.0/bin/ncl" 
#setenv NCARG_ROOT "/scratch/work/system/sw/sles10-x64/ncl-5.1.0" 


#----------------------------
# prepare input data 
#----------------------------
if(${PDATA} == "T") then 
  foreach dt (zonal surf)
   #foreach cs (aod mass burden num)
    foreach cs (aod)
      cat > load.ncl << EOF
        data_type = "${dt}"
        data_class= "${cs}"
        casa      = "${EXPA}" 
        casb      = "${EXPB}" 
        ddir      = "${DDIR}" 
EOF
      ${NCL} plot_prepdata.ncl
    end
  end
endif


#----------------------------
# mass cons 
#----------------------------
if(${PP_MS} == "T") then 
  foreach kp (0 1) 
   #foreach tp (pdf eps) 
    foreach tp (pdf) 
      foreach dt (zonal surf) 
        foreach cs (mass) 
          cat > load.ncl << EOF
            kplot     = ${kp} 
            data_type = "${dt}"
            data_class= "${cs}"
            plottype  = "${tp}" 
            casa      = "${EXPA}" 
            casb      = "${EXPB}" 
            ddir      = "${DDIR}" 
            pdir      = "${PDIR}" 
EOF
            ${NCL} plot_callplot.ncl 
        end
      end
    end
  end
endif

#----------------------------
# burden 
#----------------------------
if(${PP_BD} == "T") then
  foreach kp (0 1)
    foreach tp (pdf)
   #foreach tp (pdf eps)
      foreach dt (surf)
        foreach cs (burden)
          cat > load.ncl << EOF
            kplot     = ${kp}
            data_type = "${dt}"
            data_class= "${cs}"
            plottype  = "${tp}"
            casa      = "${EXPA}" 
            casb      = "${EXPB}" 
            ddir      = "${DDIR}" 
            pdir      = "${PDIR}" 
EOF
            ${NCL} plot_callplot.ncl
        end
      end
    end
  end
endif



#----------------------------
# number cons 
#----------------------------
if(${PP_NM} == "T") then
   foreach kp (2 3)
    foreach tp (pdf)
   #foreach tp (pdf eps)
      foreach dt (zonal surf)
        foreach cs (num)
          cat > load.ncl << EOF
            kplot     = ${kp}
            data_type = "${dt}"
            data_class= "${cs}"
            plottype  = "${tp}"
            casa      = "${EXPA}" 
            casb      = "${EXPB}" 
            ddir      = "${DDIR}" 
            pdir      = "${PDIR}" 
EOF
            ${NCL} plot_callplot.ncl
        end
      end
    end
  end
endif

#----------------------------
# number cons
#----------------------------
if(${PP_RD} == "T") then
   foreach kp (4 5)
    foreach tp (pdf)
   #foreach tp (pdf eps)
      foreach dt (surf)
        foreach cs (aod)
          cat > load.ncl << EOF
            kplot     = ${kp}
            data_type = "${dt}"
            data_class= "${cs}"
            plottype  = "${tp}"
            casa      = "${EXPA}"
            casb      = "${EXPB}"
            ddir      = "${DDIR}"
            pdir      = "${PDIR}"
EOF
            ${NCL} plot_callplot.ncl
        end
      end
    end
  end
endif

#----------------------------
# number cons
#----------------------------
#mv *.eps /pf/m/m222044/paper/ham2 
#pdf *.pdf 



end



